/**
 * @author        yangmingchao <amustlang_yang@foxmail.com>
 * @date          2024-02-28 22:16:21
 * Copyright © YourCompanyName All rights reserved
 */
import { getConf } from "@/api/skit/conf";
const SESSION_KEY = 'shareProfit_config';

/**
 * 写入系统配置-分润比列
 * @param {*} callback 
 */
export function getConfQuery(callback) {
    getConf(1).then(response => {
        // 写入缓存中
        sessionStorage.setItem(SESSION_KEY, JSON.stringify(response.data))
        // 存在回调则调用
        callback && callback(response)
    });
}
/**
 * 获取分润配置中指定选项
 * @param {*} key 
 * @returns 
 */
export function getConfigItem(key) {
    let targe = sessionStorage.getItem(SESSION_KEY) || '{}';
    targe = JSON.parse(targe)
    console.log('获取配置',targe,key,targe[key]);
    return targe[key]
}